package com.hotel.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hotel.entity.DishCollectLike;
import com.hotel.response.Result;
import com.hotel.service.DishCollectLikeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * <p>
 * 商品点赞和收藏表 前端控制器
 * </p>
 *
 * @author Lin
 * @since 2022-06-08
 */
@Api(tags = "商品收藏")
@RestController
@RequestMapping("/dishCollectLike")
public class DishCollectLikeController {

    @Resource
    private DishCollectLikeService service;


    @ApiOperation(value = "分页获取用户收藏列表")
    @GetMapping("/getCollectByUserId")
    public Result getCollectByUserId(@RequestParam(value = "username",required = false) String username,
                                     @RequestParam(value = "current",required = false,defaultValue = "1")Integer current,
                                     @RequestParam(value = "size",required = false,defaultValue = "4")Integer size){
        IPage<DishCollectLike> collect = service.getCollect(username,current,size);
        return Result.ok().data("collect",collect);
    }

}

